public class BitOprtUsage {

    public static void main(String[] args) {
        int base = 1;//0001

        int is_student_mask = base;//0001
        int is_programmer_mask = base << 1;//0010
        int is_driver_mask = base << 2;//0100
        int is_painter_mask = base << 3;//1000

        int data = 5;//0101

        boolean isStudent = (data & is_student_mask) != 0;
        //( 0101 & 0001 = 0001 )  !=0
        System.out.println(isStudent);

        boolean isProgrammer = (data & is_programmer_mask) != 0;
        //( 0101 & 0010 = 0000 )  =0
        System.out.println(isProgrammer);

        boolean isDriver = (data & is_driver_mask) != 0;
        //( 0101 & 0100 = 0100 )  !=0
        System.out.println(isDriver);

        boolean isPainter = (data & is_painter_mask) != 0;
        //( 0101 & 1000 = 0000 )  =0
        System.out.println(isPainter);
    }
}
